<?php
ini_set('display_errors',1);
set_time_limit(0); 
define('SP_ORG_ID', 'fjyd');

include_once dirname(dirname(__FILE__)).'/import/import.class.php';


include_once dirname(dirname(__FILE__)).'/mgtv_init.php';


$db = nn_get_db(NL_DB_READ);
$url = 'http://127.0.0.1/nn_cms_manager/service/asset_import/mgtv/asset_api.php';
$sql="select * from nns_mgtvbk_c2_task where nns_org_id='fjyd' limit 10";
$list = nl_db_get_all($sql, $db);
$log = dirname(dirname(dirname(__FILE__))).'/data/log/import';
$import_obj = new import($url,$log);
foreach ($list as $value) {
	$id = $value['nns_ref_id'];	
	$depot_info = category_model::__get_category_all($id,'vod');
	$category_all = category_model::get_category_id_by_content($depot_info['depot_info'],0);
	$category = $category_all[0]['nns_name'];
	
	$sql="select * from nns_vod where nns_id='{$id}'";
	$vod = nl_db_get_one($sql, $db);
	$assets_content="<video  assets_id='$id' assets_category='$category'  video_type='0' name='{$vod['nns_name']}' sreach_key='{$vod['nns_keyword']}' view_type='0' director='{$vod['nns_director']}' player='{$vod['nns_actor']}' tag='{$vod['nns_kind']}' region='{$vod['nns_area']}' release_time='{$vod['nns_show_time']}' totalnum='{$vod['nns_all_index']}' national='{$vod['nns_area']}' smallpic='{$vod['nns_image2']}'   intro='{$vod['nns_summary']}'  producer='{$vod['nns_copyright']}' adaptor='{$vod['nns_screenwriter']}' subordinate_name='{$vod['nns_alias_name']}'   english_name='{$vod['nns_eng_name']}'   language='{$vod['nns_text_lang']}'   caption_language='{$vod['nns_text_lang']}'>
</video>";
	echo $assets_content;
	
	$result = $import_obj->import_assets($assets_content);
	
	//$result_info = json_decode(json_encode(@simplexml_load_string($result)),true);
	
	echo $result;
	die;
	
}
?>